<%@ page import="com.checkfree.isolutions.customer.persist.*" %>
<%@ page import="com.checkfree.isolutions.statement.*" %>
<%@ page import="com.checkfree.isolutions.statement.persist.*" %>
<%@ page import="com.myebills.ebpsfrontend.cust.utils.*" %>
<%@ page import="com.myebills.ebpsfrontend.cust.controller.*" %>
<%@ page import="com.checkfree.isolutions.property.Properties" %>
<%@ page import="com.checkfree.isolutions.property.PropertiesConfig" %>
<%@ page import="java.util.*" %>
<%@ page import="java.net.*" %>
<%@ page import="java.text.*" %>

<%@ include file="../../@functions.jsp" %>

<script language="JavaScript">
	function updateSectionTotal(section,total) {
		$("#"+section).text(total.toFixed(2));
	}
</script>

<%
final EbppxEcsUser ecsUser = (EbppxEcsUser) session.getAttribute(EbppxConstants.ECS_USER);
final String typeIndex = (String) request.getAttribute("typeIndex");
final String stype = (String) request.getAttribute("type");	
final String intPhoneIndex = (String) request.getAttribute("phoneIndex");	
final String randomKey = (String) session.getAttribute(EbppxConstants.RANDOM_KEY);
final String stmtIndex = (String) session.getAttribute("stmtIndex");
//System.out.println("stmtIndexstmtIndexstmtIndex ================== !!!!!!!!!!!!!" + stype);
String param = EncryptionHelper.encodeURL(EncryptionHelper.encrypt(stype, randomKey));
String param1 = EncryptionHelper.encodeURL(EncryptionHelper.encrypt(stype.replaceAll(" ", "")+"Section", randomKey));

String msisdn = "";
String stmtDate = "";
String accno = "";
String phoneNo = "";
String tempPhoneNo = "";
String tempSimNo = "";
String keySuffix = "_OTH_Key";
String simNo = "";

if(ecsUser != null){
	msisdn = ecsUser.getMsisdn();
	accno = ecsUser.getSAccount();
	if(msisdn != null){
		phoneNo = msisdn;
	}
}
String telDetUrl = "ChargesData_v1r00?phoneNo="+msisdn+"&stmtIndex="+stmtIndex;
String telSummUrl = "ChargesDetails_v1r00?phoneIndex="+intPhoneIndex+"&type="+param+"&typeIndex="+param1+"&stmtIndex="+stmtIndex;
//System.out.println("!!!!!!!!!!!!!!!!telSummUrl = "+stmtIndex);
StatementSection cfiPhoneNumberSection = (StatementSection)request.getAttribute("PhoneNumberSection");
if(cfiPhoneNumberSection != null){
//if DomesticCharges || Roaming Charges || InternetCharges
	if(typeIndex.equals("DomesticCallsSection") || typeIndex.equals("MobileCallsSection") || typeIndex.equals("InternationalChargesSection") || typeIndex.equals("BusinessVoiceVPNSection") || typeIndex.equals("MaxisCommunityCallsSection")){
		 double total =0;
		 String searchKey = stype.replace(' ','_') + keySuffix;
		 //System.out.println("!!!!!!searchKey@@@@@@@@@@@@@@@@"+searchKey);
		 String key0 = getSectionKey(searchKey);
		 //System.out.println("!!!!!!!!!!!key0@@@@@@@@@@@@@@@@@@"+key0);
		 SectionProperties sp0 = getSectionProperties(key0);
		 StatementSection section0 = cfiPhoneNumberSection.getSection(sp0.name);
		 StatementSection cfiItemWithRebateSection = cfiPhoneNumberSection.getSection("ItemWithRebateSection");
		 StatementSection cfiUsageChargesSection = null;
		 if(cfiItemWithRebateSection != null){
			cfiUsageChargesSection = cfiItemWithRebateSection.getSection("UsageChargesSection");
		 }
		 if(cfiUsageChargesSection != null){
			int sectionCount1_3 = (int) cfiUsageChargesSection.getSectionCount("RepeatSection");
			//System.out.println("cfiUsageChargesSection.====="+sectionCount1_3);
			for (int index1_3 = 0; index1_3 < sectionCount1_3; index1_3++) {
				StatementSection cfiRSection1_3 = cfiUsageChargesSection.getRepeatSection("RepeatSection", index1_3);
				String item = cfiRSection1_3.getFieldText("Item");
				if(item.equals(stype)){
					total = getFieldAmount(cfiRSection1_3,"Amount");
					//System.out.println("item.====="+item);
					//System.out.println("total.====="+total);
					
				}
			}
		 }
		 //System.out.println("sp0.name====="+sp0.name);
		 
/**********************************************************************************************************************************************************/
// Type00_DomesticCallCharges
/**********************************************************************************************************************************************************/
%><div class="domestic-charges popup">
	<div class="title"><label><%=stype%></label><sup>RM</sup><%=formatAmount(total)%></div>
		<div class="content">
			<ul>
<%			if (sp0.type.equals("Type00") && (section0 != null)){
				Iterator iterator0 = sp0.childSectionKeyList.iterator();
				int spanIndex = 0;
				int formIndex = 0;
				while (iterator0.hasNext()){
					spanIndex++;
					String key1 = (String)iterator0.next();
					SectionProperties sp1 = getSectionProperties(key1);
					StatementSection section1 = section0.getSection(sp1.name);

/*********************************************************************/
// Type01_CallCharges
/*********************************************************************/

					if (sp1.type.equals("Type01") && (section1 != null)){
						formIndex++;
						double sectionTotal = 0;
%>
			<li>
				<h6><label><%=sp1.title_ENG%></label><sup>RM</sup><span id="sectionTotal01_<%=spanIndex%>"></span></h6>
				<div class="form">
					<form action="#" method="#">
						<fieldset>
							<div>
								<span class="select-custom">
									<select class="form1">
										<option value="">- Please Select -</option>
<%
								Iterator iterator1 = sp1.childSectionKeyList.iterator();
								while (iterator1.hasNext()){

									String key2 = (String)iterator1.next();
									SectionProperties sp2 = getSectionProperties(key2);
									StatementSection section2 = section1.getSection(sp2.name);
									if (section2 != null){
										sectionTotal += getSectionTotal(section2); 
										//System.out.println("sectionTotal = "+formatAmount(sectionTotal));
										String nextUrl = telDetUrl + "&sectionKey=" + sp2.key+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;
%>
										<option value="<%=nextUrl%>"><%=sp2.title_ENG%></option>
<%
									} // section2 != null
								} // iterator1.hasNext()
%>
									</select>
								</span>
							</div>
						</fieldset>
					</form>
				</div>
			</li>
		<script>updateSectionTotal("sectionTotal01_"+<%=spanIndex%>,<%=sectionTotal%>)</script>
<%
							} // sp1.type.equals("Type01") && (section1 != null)

/*********************************************************************/
// Type12
/*********************************************************************/

							if (sp1.type.equals("Type12") && (section1 != null)){
								String nextUrl = telDetUrl + "&sectionKey=" + sp1.key+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;
								double sectionTotal12 = getSectionTotal(section1);
%>
			<li><h6><label><a href="<%=nextUrl %>" class="details-list"><%=sp1.title_ENG%></a></label><sup>RM</sup><%=formatAmount(sectionTotal12) %></h6></li>
<%
							} // sp1.type.equals("Type12") && (section1 != null)

/*********************************************************************/
// Type03
/*********************************************************************/

							if (sp1.type.equals("Type03")){
								double sectionTotal = 0;
								ArrayList sectionNameList = new ArrayList();
								int section1Count = (int) section0.getSectionCount(sp1.name);
								for (int i=0; i<section1Count; i++){
									section1 = section0.getRepeatSection(sp1.name,i);
									String title_ENG = sp1.title_ENG;
									if (sp1.title_ENG.startsWith("*")){
										title_ENG = section1.getFieldText(sp1.title_ENG.substring(1));
									}
									sectionNameList.add(title_ENG);
								} // for (int i=0; i<section1Count; i++)

								Iterator iterator1 = sp1.childSectionKeyList.iterator();
								while (iterator1.hasNext()){
									String key2 = (String)iterator1.next();
									SectionProperties sp2 = getSectionProperties(key2);
%>
			<li>
				<h6><label><%=sp2.title_ENG%></label><sup>RM</sup><span id="sectionTotal03"></span></h6>
				<div class="form">
					<form action="#" method="#">
						<fieldset>
							<div>
								<span class="select-custom">
									<select class="form1">
										<option value="">- Please Select -</option>
<%
									for (int i=0; i<section1Count; i++){
										section1 = section0.getRepeatSection(sp1.name,i);
										if (section1 != null){
											Iterator iterator2 = sectionNameList.iterator();
											while (iterator2.hasNext()){
												StatementSection section2 = section1.getSection(sp2.name);
												String title_ENG = (String)iterator2.next();
												String check_title_ENG = sp1.title_ENG;

												if (sp1.title_ENG.startsWith("*")){
													check_title_ENG = section1.getFieldText(sp1.title_ENG.substring(1));
												}

											   if (title_ENG.equals(check_title_ENG)){
													if (section2 != null){
														sectionTotal += getSectionTotal(section2);
														String nextUrl = telDetUrl + "&sectionKey=" + sp2.key + "&repeatSectionKey=" + title_ENG+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;
%>
										<option value="<%=nextUrl%>"><%=title_ENG%></option>
<%
													}
												}

											} // iterator2.hasNext()
										}
									} // for (int i=0; i<section1Count; i++)
%>
									</select>
								</span>
							</div>
						</fieldset>
					</form>
				</div>
			</li>
		<script>updateSectionTotal("sectionTotal03",<%=sectionTotal%>)</script>
<%
								} // iterator1.hasNext()
							} // sp1.type.equals("Type03")

/*********************************************************************/
// Type04
/*********************************************************************/

							if (sp1.type.equals("Type04") && (section1 != null)){
								double sectionTotal = 0;
								int section1Count = (int) section0.getSectionCount(sp1.name);
								String selectedSectionName = (String)request.getAttribute("selectedSectionName");
								if (selectedSectionName == null){
									selectedSectionName = "";
									session.setAttribute("selectedSectionName",selectedSectionName);
								}

%>
<li>
				<h6><label><%=sp1.title_ENG%></label></h6>
				<div class="form">
					<form action="#" method="#">
						<fieldset>
							<div>
								<span class="select-custom">
									<select class="form1">
										<option value="">- Please Select -</option>
<%
								Iterator iterator1 = sp1.childSectionKeyList.iterator();
								while (iterator1.hasNext()){
									String selected = "";

									String key2 = (String)iterator1.next();
									SectionProperties sp2 = getSectionProperties(key2);
									StatementSection section2 = section1.getSection(sp2.name);
									if (section2 != null){
										sectionTotal += getSectionTotal(section2);
										 //String nextUrl = telDetUrl + "&sectionKey=" + sp2.key+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;
										 String newUrl = telSummUrl + "&selectedSectionName=" + EncryptionHelper.encodeURL(sp2.title_ENG)+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;

										if(sp2.type.equals("Type02")){
											newUrl = telDetUrl + "&sectionKey=" + sp2.key+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;
										}

										if (selectedSectionName.equals(sp2.title_ENG)){
											selected = "selected";
										}
%>
										<option value="<%=newUrl%>" <%=selected%>><%=sp2.title_ENG%></option>
<%
									} // section2 != null
								} // iterator1.hasNext()
%>
									</select>
								</span>
							</div>
						</fieldset>
					</form>
				</div>
			</li>
<%
								for (int i=0; i<section1Count; i++){
									section1 = section0.getRepeatSection(sp1.name,i);
									if (section1 != null){
										String title_ENG = sp1.title_ENG;
										if (sp1.title_ENG.startsWith("*")){
											title_ENG = section1.getFieldText(sp1.title_ENG.substring(1));
										}
										Iterator iterator2 = sp1.childSectionKeyList.iterator();
										while (iterator2.hasNext()){
											String key2 = (String)iterator2.next();
											SectionProperties sp2 = getSectionProperties(key2);
											StatementSection section2 = section1.getSection(sp2.name);
											if (section2 != null){
												Iterator iterator3 = sp2.childSectionKeyList.iterator();
												while (iterator3.hasNext()){
													String key3 = (String)iterator3.next();
													SectionProperties sp3 = getSectionProperties(key3);
													StatementSection section3 = section2.getSection(sp3.name);
													if (section3 != null){
														sectionTotal = getSectionTotal(section3);
														String nextUrl = telDetUrl + "&sectionKey=" + sp3.key + "&repeatSectionKey=" + EncryptionHelper.encodeURL(sp2.title_ENG)+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;
														if (selectedSectionName.equals(sp2.title_ENG)){
%>
			<li><h6><label><a href="<%=nextUrl%>" class="details-list"><%=sp3.title_ENG%></a></label><sup>RM</sup><%=formatAmount(sectionTotal)%></h6></li>
<%
														}// end if (selectedSectionName.equals(sp2.title_ENG))
													}// end if (section3 != null)
												}// end while (iterator3.hasNext())
											}// end if (section2 != null)
										}// end while (iterator2.hasNext())
									}// end if (section1 != null)
								}// for (int i=0; i<section1Count; i++)
							} // sp1.type.equals("Type04") && (section1 != null)

/*********************************************************************/
// Type06
/*********************************************************************/

							if (sp1.type.equals("Type06") && (section1 != null)){
								double sectionTotal = 0;
								int section1Count = (int) section0.getSectionCount(sp1.name);
								String selectedSectionName = (String)request.getAttribute("selectedSectionName");
								if (selectedSectionName == null){
									selectedSectionName = "";
									session.setAttribute("selectedSectionName",selectedSectionName);
								}

%>
			<li>
				<h6><label><%=sp1.title_ENG%></label></h6>
				<div class="form">
					<form action="#" method="#">
						<fieldset>
							<div>
								<span class="select-custom">
									<select class="form1">
										<option value="">- Please Select -</option>
<%
								Iterator iterator1 = sp1.childSectionKeyList.iterator();
								while (iterator1.hasNext()){
									String selected = "";

									String key2 = (String)iterator1.next();
									SectionProperties sp2 = getSectionProperties(key2);
									StatementSection section2 = section1.getSection(sp2.name);
									if (section2 != null){
										sectionTotal += getSectionTotal(section2);
										 //String nextUrl = telDetUrl + "&sectionKey=" + sp2.key+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;
										 String newUrl = telSummUrl + "&selectedSectionName=" + EncryptionHelper.encodeURL(sp2.title_ENG)+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;

										if (selectedSectionName.equals(sp2.title_ENG)){
											selected = "selected";
										}
%>
										<option value="<%=newUrl%>" <%=selected%>><%=sp2.title_ENG%></option>
<%
									} // section2 != null
								} // iterator1.hasNext()
%>
									</select>
								</span>
							</div>
						</fieldset>
					</form>
				</div>
			</li>
<%
								for (int i=0; i<section1Count; i++){
									section1 = section0.getRepeatSection(sp1.name,i);
									if (section1 != null){
										String title_ENG = sp1.title_ENG;
										if (sp1.title_ENG.startsWith("*")){
											title_ENG = section1.getFieldText(sp1.title_ENG.substring(1));
										}
										Iterator iterator2 = sp1.childSectionKeyList.iterator();
										while (iterator2.hasNext()){
											String key2 = (String)iterator2.next();
											SectionProperties sp2 = getSectionProperties(key2);
											StatementSection section2 = section1.getSection(sp2.name);
											if (section2 != null){
												Iterator iterator3 = sp2.childSectionKeyList.iterator();
												while (iterator3.hasNext()){
													String key3 = (String)iterator3.next();
													SectionProperties sp3 = getSectionProperties(key3);
													StatementSection section3 = section2.getSection(sp3.name);
													if (section3 != null){
														String nextUrl = telDetUrl + "&sectionKey=" + sp3.key + "&repeatSectionKey=" + sp2.title_ENG+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;
														if (selectedSectionName.equals(sp2.title_ENG)){
															Iterator iterator4 = sp3.childSectionKeyList.iterator();
															while (iterator4.hasNext()){
																String key4 = (String)iterator4.next();
																SectionProperties sp4 = getSectionProperties(key4);
																StatementSection section4 = section3.getSection(sp4.name);
																if (section4 != null){
																	sectionTotal = getSectionTotal(section4);
																	nextUrl = telDetUrl + "&sectionKey=" + sp4.key + "&repeatSectionKey=" + EncryptionHelper.encodeURL(sp3.title_ENG)+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;
																}
															}

%>
			<li><h6><label><a href="<%=nextUrl%>" class="details-list"><%=sp3.title_ENG%></a></label><sup>RM</sup><%=formatAmount(sectionTotal)%></h6></li>
<%
														}// end if (selectedSectionName.equals(sp2.title_ENG))
													}// end if (section3 != null)
												}// end while (iterator3.hasNext())
											}// end if (section2 != null)
										}// end while (iterator2.hasNext())
									}// end if (section1 != null)
								}// for (int i=0; i<section1Count; i++)
							} // sp1.type.equals("Type04") && (section1 != null)

/*********************************************************************/
// Type10
/*********************************************************************/

							if (sp1.type.equals("Type10") && (section1 != null)){
								double sectionTotal = 0;
								int section1Count = (int) section0.getSectionCount(sp1.name);
								String selectedSectionName = (String)session.getAttribute("selectedSectionName");
								if (selectedSectionName == null){
									selectedSectionName = "";
									session.setAttribute("selectedSectionName",selectedSectionName);
								}

%>
			<li>
				<h6><label><%=sp1.title_ENG%></label><sup>RM</sup><span id="sectionTotal10"></span></h6>
				<div class="form">
					<form action="#" method="#">
						<fieldset>
							<div>
								<span class="select-custom">
									<select class="form1">
										<option value="">- Please Select -</option>
<%
								Iterator iterator1 = sp1.childSectionKeyList.iterator();
								while (iterator1.hasNext()){
									String selected = "";

									String key2 = (String)iterator1.next();
									SectionProperties sp2 = getSectionProperties(key2);
									StatementSection section2 = section1.getSection(sp2.name);
									if (section2 != null){
										sectionTotal += getSectionTotal(section2);
										 //String nextUrl = telDetUrl + "&sectionKey=" + sp2.key+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;
										 String newUrl = telSummUrl + "&selectedSectionName=" + sp2.title_ENG+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;

										if (selectedSectionName.equals(sp2.title_ENG)){
											selected = "selected";
										}
%>
										<option value="<%=newUrl%>" <%=selected%>><%=sp2.title_ENG%></option>
<%
									} // section2 != null
								} // iterator1.hasNext()
%>
									</select>
								</span>
							</div>
						</fieldset>
					</form>
				</div>
			</li>
		<script>updateSectionTotal("sectionTotal10",<%=sectionTotal%>)</script>
<%
								boolean boolFirstTime=true;
								for (int i=0; i<section1Count; i++){
									section1 = section0.getRepeatSection(sp1.name,i);
									if (section1 != null){
										String title_ENG = sp1.title_ENG;
										if (sp1.title_ENG.startsWith("*")){
											title_ENG = section1.getFieldText(sp1.title_ENG.substring(1));
										}
										Iterator iterator2 = sp1.childSectionKeyList.iterator();
										while (iterator2.hasNext()){
											String key2 = (String)iterator2.next();
											SectionProperties sp2 = getSectionProperties(key2);
											StatementSection section2 = section1.getSection(sp2.name);
											if (section2 != null){
												Iterator iterator3 = sp2.childSectionKeyList.iterator();
												while (iterator3.hasNext()){
													String key3 = (String)iterator3.next();
													SectionProperties sp3 = getSectionProperties(key3);
													int section3Count = (int)section2.getSectionCount(sp3.name);
													for(int j=0;j<section3Count;j++){
														StatementSection sectionR3 = section2.getRepeatSection(sp3.name,j);

														//StatementSection section3 = section2.getSection(sp3.name);
														if (sectionR3 != null){
															String title = sectionR3.getFieldText(sp3.title_ENG);
															String nextUrl = telDetUrl + "&sectionKey=" + sp3.key + "&repeatSectionKey=" + sp2.title_ENG+  "&repeatSectionIndex=" +j+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;
															if (selectedSectionName.equals(sp2.title_ENG)){
																if(boolFirstTime){
%>
			<li>
				<div class="form">
					<form action="#" method="#">
						<fieldset>
							<div>
								<span class="select-custom">
									<select class="form1">
										<option value="">- Please Select -</option>
<%
																	boolFirstTime=false;
																}// end if(boolFirstTime)
%>
									<option value="<%=nextUrl%>"><%=title%></option>
								</span>
							</div>
						</fieldset>
					</form>
				</div>
			</li>
<%
															}// end if (selectedSectionName.equals(sp2.title_ENG))
														}// end if (section3 != null)
													}// for(int j=0;j<section3Count;j++){
												}// end while (iterator3.hasNext())
											}// end if (section2 != null)
										}// end while (iterator2.hasNext())
									}// end if (section1 != null)
								}// for (int i=0; i<section1Count; i++)
							} // sp1.type.equals("Type10") && (section1 != null)

/*********************************************************************/
// Type05______Roaming_Country
/*********************************************************************/

							if (sp1.type.equals("Type05")){
								double sectionTotal = 0;
								ArrayList sectionNameList = new ArrayList();
								sectionTotal = getSectionTotal(section0);//can get the sectionTotal directly
								int section1Count = (int) section0.getSectionCount(sp1.name);
								for (int i=0; i<section1Count; i++){
									section1 = section0.getRepeatSection(sp1.name,i);
									String title_ENG = sp1.title_ENG;
									if (sp1.title_ENG.startsWith("*")){
										title_ENG = section1.getFieldText(sp1.title_ENG.substring(1));
									}
									sectionNameList.add(title_ENG);
								} // for (int i=0; i<section1Count; i++)


								String selectedSectionName = (String)request.getAttribute("selectedSectionName");
								//System.out.println("selectedSectionName === "+selectedSectionName);
								if (selectedSectionName == null){
									selectedSectionName = "";
									session.setAttribute("selectedSectionName",selectedSectionName);
								}

%>

			<li>
				<h6><label><%=sp1.title_ENG.substring(1)%></label><sup>RM</sup><%=formatAmount(sectionTotal)%></h6>
				<div class="form">
					<form action="#" method="#">
						<fieldset>
							<div>
								<span class="select-custom">
									<select class="form1">
										<option value="">- Please Select -</option>
<%
								Iterator iterator1 = sectionNameList.iterator();
								while (iterator1.hasNext()){
									String title_ENG = (String)iterator1.next();
									String selected = "";
									String newUrl = telSummUrl + "&selectedSectionName=" + EncryptionHelper.encodeURL(title_ENG)+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;
									if (selectedSectionName.equals(title_ENG)){
										selected = "selected";
									}
%>
										<option value="<%=newUrl%>" <%=selected%>><%=title_ENG%></option>
<%
								} // iterator1.hasNext()
%>
									</select>
								</span>
							</div>
						</fieldset>
					</form>
				</div>
			</li>
<%								double sectionTotal0 = 0;
								for (int i=0; i<section1Count; i++){
									section1 = section0.getRepeatSection(sp1.name,i);
									if (section1 != null){
										String title_ENG = sp1.title_ENG;
										if (sp1.title_ENG.startsWith("*")){
											title_ENG = section1.getFieldText(sp1.title_ENG.substring(1));
										}
										Iterator iterator2 = sp1.childSectionKeyList.iterator();
										int repeatSectionIndex = 0;
										while (iterator2.hasNext()){
											String key2 = (String)iterator2.next();
											SectionProperties sp2 = getSectionProperties(key2);
											StatementSection section2 = section1.getSection(sp2.name);
											if (section2 != null){
												double sectionTotal1 = getSectionTotal(section2);
												sectionTotal0 += sectionTotal1;
												if (title_ENG.equals(selectedSectionName)){
													repeatSectionIndex++;
													//ChargesData_v1r00?sectionKey=GSM03_01_03&phoneIndex=2&repeatSectionKey=HongKong&repeatSectionIndex=1&phoneNo=60125076999
													String nextUrl = telDetUrl + "&sectionKey=" + sp2.key + "&repeatSectionKey=" + EncryptionHelper.encodeURL(title_ENG)+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;
%>
			<li><h6><label><a href="<%=nextUrl%>" class="details-list"><%=sp2.title_ENG%></a></label><sup>RM</sup><%=formatAmount(sectionTotal1)%></h6></li>
<%
												}
											} // section2 != null
										} // iterator1.hasNext()
									}
								} // for (int i=0; i<section1Count; i++)
							} // sp1.type.equals("Type05")

/*********************************************************************/
//
/*********************************************************************/

						} // iterator0.hasNext()
					} // sp0.type.equals("Type00") && (section0 != null)

/**********************************************************************************************************************************************************/
// Type01
/**********************************************************************************************************************************************************/

					if (sp0.type.equals("Type01") && (section0 != null)){
%>
			<li>
				<h6><label><%=sp0.title_ENG%></label><sup>RM</sup>4000.00</h6>
				<div class="form">
					<form action="#" method="#">
						<fieldset>
							<div>
								<span class="select-custom">
									<select class="form1">
										<option value="">- Please Select -</option>
<%
						Iterator iterator0 = sp0.childSectionKeyList.iterator();
						while (iterator0.hasNext()){

							String key1 = (String)iterator0.next();
							SectionProperties sp1 = getSectionProperties(key1);
							StatementSection section1 = section0.getSection(sp1.name);
							if (section1 != null){
								 String nextUrl = telDetUrl + "&sectionKey=" + sp1.key+ "&phoneIndex=" +intPhoneIndex+ "&simNo=" +simNo;
%>
										<option value="<%=nextUrl%>"><%=sp1.title_ENG%></option>
<%
							} // section1 != null
						} // iterator0.hasNext()
%>
									</select>
								</span>
							</div>
						</fieldset>
					</form>
				</div>
			</li>
<%
					} //sp0.type.equals("Type01") && (section0 != null)

/**********************************************************************************************************************************************************/
//
/**********************************************************************************************************************************************************/
	 
				 
	}//END if DomesticCharges || Roaming Charges || InternetCharges
	else{
		StatementSection itemWithRebateSection = cfiPhoneNumberSection.getSection("ItemWithRebateSection");
		if(itemWithRebateSection != null){
		StatementSection cfiChargesSection = itemWithRebateSection.getSection(typeIndex);
		if(cfiChargesSection != null){
			double totalSectionCharges = getSectionTotal(cfiChargesSection);
			int sectionCount1_7 = (int) cfiChargesSection.getSectionCount("RepeatSection");
%>
<div class="value-added-services popup">
	<div class="title"><label><%=stype%></label><sup>RM</sup><%=formatAmount(totalSectionCharges)%></div>
		<div class="content">
			<ul>
<%			for (int index1_7 = 0; index1_7 < sectionCount1_7; index1_7++) {
				String item = "";
				String amount = "";
				String date = "";
				StatementSection cfiChargesRepeatSection = cfiChargesSection.getRepeatSection("RepeatSection", index1_7);
				item = cfiChargesRepeatSection.getFieldText("Item");
				amount = cfiChargesRepeatSection.getFieldText("Amount");
				date = cfiChargesRepeatSection.getFieldText("Date");
				//System.out.println("amount !!!==== "+amount);%>
				<li><h6><label><%=item%><%if(date != ""){%> - <%=date%><%}%></label><%if(amount != ""){%><sup>RM</sup><%=amount%><%}%></h6></li>
<%				}
			}
		}
	}
}
%>
		</ul>
	</div>
</div>
<script language="JavaScript">
<!--
	$(function(){
	  $(".form1").bind('change', function() {
	  <!-- console.log($(this).val()); //-->
	    $.fancybox({
		'width': 800,
		'height': 700,
		'type': 'ajax',
	    href:$(this).val()})});
	 });
	 
	 $('.details-list').fancybox({
		type	 : 'ajax',
		width	 : 400,
		height	 : 500,
		fitToView	: true,
		autoSize	: true,
		closeClick	: false,
		openEffect	: 'fade',
		closeEffect	: 'fade',
		padding	 : 0
		});

//-->
</script>
